package com.pi.base.util;

import java.util.HashMap;
import java.util.Map;

public class MapBuilder<T> {

	  public Builder<T> b;
	  
	  public MapBuilder(Builder<T> b){
	        this.b = b;
	    }
	     
	    public Map<String,T> map(){
	        return b.map;
	    }
	     
	    public T get(String key){
	        return b.map.get(key);
	    }
	    
	    public static class Builder<T>{
	         
	        public Map<String, T> map;
	         
	        public Builder(){
	            map = new HashMap<String, T>();
	        }
	         
	        public Builder<T> map(String key, T value){
	        	if(value != null &&  !"".equals(value.toString())){
	              map.put(key, value);
	        	}
	            return this;
	        }
	         
	         
	        public MapBuilder<T> build(){
	            return new MapBuilder<T>(this);
	        }
	    }
}
